Skip to content

Recreate single named schema handling across Map methods#9597

Merged
tobias-tengler merged 2 commits intomainfrom
tte/recreate-schemaname-handling-across-map-methods
Apr 24, 2026
Merged

Recreate single named schema handling across Map methods#9597
tobias-tengler merged 2 commits intomainfrom
tte/recreate-schemaname-handling-across-map-methods

Conversation

@tobias-tengler
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 24, 2026 16:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates HotChocolate adapter endpoint/document mapping to better handle the “single named schema” case by auto-resolving the schema name when the caller does not specify one.

Changes:

  • Add schema-name auto-resolution via IRequestExecutorProvider.SchemaNames when exactly one schema is registered.
  • Apply this resolution consistently across OpenAPI endpoint mapping, OpenAPI document transformer wiring, and MCP endpoint mapping.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/HotChocolate/Adapters/src/Adapters.OpenApi.AspNetCore/Extensions/OpenApiOptionsExtensions.cs Resolve schema name at transformer execution time when only one schema exists.
src/HotChocolate/Adapters/src/Adapters.OpenApi.AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs Resolve schema name before retrieving keyed OpenAPI endpoint data source.
src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/EndpointRouteBuilderExtensions.cs Resolve schema name before retrieving keyed MCP handler proxy.
Comments suppressed due to low confidence (1)

src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/EndpointRouteBuilderExtensions.cs:24

  • Please add an integration test for the new schemaName auto-resolution: when exactly one schema is registered with a non-default name, MapGraphQLMcp() should work when called without an explicit schemaName (i.e., it should resolve the keyed StreamableHttpHandlerProxy for that schema).
        TryResolveSchemaName(endpoints.ServiceProvider, ref schemaName);
        schemaName ??= ISchemaDefinition.DefaultName;

        var streamableHttpHandler =
            endpoints.ServiceProvider.GetKeyedService<StreamableHttpHandlerProxy>(schemaName)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants